<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-06-27 19:53:36
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-06-27 20:03:48
 * @FilePath: \geyao\第七十七题 分隔符.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>分隔符</title>
</head>
<body>
  <script type="text/javascript">
    function _comma(number) {
        // 补全代码
          // 补全代码
    var num = number;
    var str = '';
    while (num > 1000) {
        //得到千位之后的数 并在三位数之前加上，加上之前获得的数  
        str = ',' + (num % 1000) + str //,300
        //得到千位之前的数 12
        num = parseInt(num / 1000) //12
    }
    //剩下的数字不大于三位 则直接加上之前获得的数
    return num + str; //12,300 
    }
</script>
</body>
</html>